package cn.com.headfree.mouldshow.dao.impl;

import cn.com.headfree.entity.TWorkExpInfoTemp;
import cn.com.headfree.mouldshow.dao.TWorkExpInfoTempDao;
import com.gta.edu.sdk.base.dao.impl.BaseDaoImpl;
import org.springframework.stereotype.Repository;

import java.sql.Timestamp;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@Repository("/tWorkExpInfoTempDao")
public class TWorkExpInfoTempDaoImpl extends BaseDaoImpl<TWorkExpInfoTemp> implements TWorkExpInfoTempDao {


    @Override
    public void saveInfo(TWorkExpInfoTemp tWorkExpInfoTemp) {
        String sql = "insert into t_work_exp_info_temp (id,erp_no,user_name,id_card_no,start_date,end_date,company,dept,post,rank,job_content,post_type,org_id,creater_id,creater_name,create_time,updater_id,updater_name,update_time,del_sign,is_valid,audit_state,orignal_id,business_type_id,primitive_id) values ";
        StringBuilder sqlBuilder = new StringBuilder(sql);
        sqlBuilder.append("(#{id,jdbcType=VARCHAR},").append("#{erp_no,jdbcType=VARCHAR},")
                .append("#{user_name,jdbcType=VARCHAR},").append("#{id_card_no,jdbcType=VARCHAR},")
                .append("#{start_date,jdbcType=DATE},").append("#{end_date,jdbcType=DATE},")
                .append("#{company,jdbcType=VARCHAR},").append("#{dept,jdbcType=VARCHAR},")
                .append("#{post,jdbcType=VARCHAR},").append("#{rank,jdbcType=VARCHAR},")
                .append("#{job_content,jdbcType=VARCHAR},").append("#{post_type,jdbcType=VARCHAR},")
                .append("#{org_id,jdbcType=VARCHAR},").append("#{creater_id,jdbcType=VARCHAR},").append("#{creater_name,jdbcType=VARCHAR},")
                .append("#{create_time,jdbcType=DATE},").append("#{updater_id,jdbcType=VARCHAR},")
                .append("#{updater_name,jdbcType=VARCHAR},").append("#{update_time,jdbcType=DATE},")
                .append("#{del_sign,jdbcType=INTEGER},").append("#{is_valid,jdbcType=INTEGER},")
                .append("#{audit_state,jdbcType=INTEGER},").append("#{orignal_id,jdbcType=VARCHAR},")
                .append("#{business_type_id,jdbcType=VARCHAR},").append("#{primitive_id,jdbcType=VARCHAR})");
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("id", tWorkExpInfoTemp.getId());
        params.put("erp_no", tWorkExpInfoTemp.getErpNo());
        params.put("user_name", tWorkExpInfoTemp.getUserName());
        params.put("id_card_no", tWorkExpInfoTemp.getIdCardNo());
        params.put("start_date", tWorkExpInfoTemp.getStartDate());
        params.put("end_date", tWorkExpInfoTemp.getEndDate());
        params.put("company", tWorkExpInfoTemp.getCompany());
        params.put("dept", tWorkExpInfoTemp.getDept());
        params.put("post", tWorkExpInfoTemp.getPost());
        params.put("rank", tWorkExpInfoTemp.getRank());
        params.put("job_content", tWorkExpInfoTemp.getJobContent());
        params.put("post_type", tWorkExpInfoTemp.getPostType());
        params.put("org_id", tWorkExpInfoTemp.getOrgId());
        params.put("creater_id", tWorkExpInfoTemp.getCreaterId());
        params.put("creater_name", tWorkExpInfoTemp.getCreaterName());
        params.put("create_time", new Timestamp(new Date().getTime()));
        params.put("updater_id", tWorkExpInfoTemp.getUpdaterId());
        params.put("updater_name", tWorkExpInfoTemp.getUpdaterName());
        params.put("update_time", new Timestamp(new Date().getTime()));
        params.put("del_sign", 0);
        params.put("is_valid", tWorkExpInfoTemp.getIsValid());
        params.put("audit_state", tWorkExpInfoTemp.getAuditState());
        params.put("orignal_id", tWorkExpInfoTemp.getOrignalId());
        params.put("business_type_id", tWorkExpInfoTemp.getBusinessTypeId());
        params.put("primitive_id", tWorkExpInfoTemp.getPrimitiveId());
        this.executeSql(sqlBuilder.toString(), params);
    }
}
